package com.gcsoftware.web.controller.admin;

import com.alibaba.fastjson.JSONObject;
import com.gcsoftware.utils.MapUtils;
import com.gcsoftware.utils.SysConst;
import com.gcsoftware.utils.log.InvokeLog;
import com.gcsoftware.utils.log.LogUtils;
import com.gcsoftware.web.beans.T_GW_APPS;
import com.gcsoftware.web.beans.T_GW_APP_IPS;
import com.gcsoftware.web.beans.T_GW_INTERFS;
import com.gcsoftware.web.beans.request.GetAppsReq;
import com.gcsoftware.web.service.T_COM_SYS_DICT_SERVICE;
import com.gcsoftware.web.service.T_GW_APPS_SERVICE;
import com.gcsoftware.web.service.T_GW_INTERF_SERVICE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by qs on 2018/3/20.
 */
@Controller
@RequestMapping("/interf")
public class InterfsController {

    @Autowired
    private T_GW_INTERF_SERVICE service;

    @Autowired
    private T_COM_SYS_DICT_SERVICE dictService;

    @Autowired
    private T_GW_APPS_SERVICE appsService;

    @RequestMapping(value = "")
    public String interfList(Model model) {
        model.addAttribute("interfStatusList" , dictService.queryForList(SysConst.DICT_GRP_INTERF_STATUS));
        model.addAttribute("appList" , appsService.queryProviderList(null));
        return "admin/interf-list";
    }

    @RequestMapping(value = "/list" , method = RequestMethod.POST)
    @ResponseBody
    public List<T_GW_INTERFS> queryForList(@RequestParam(value = "c_APP_ID" , required = false) String c_APP_ID,
                                           @RequestParam(value = "c_INTERF_NAME" , required = false) String c_INTERF_NAME,
                                           @RequestParam(value = "c_INTERF_STATUS" , required = false) String c_INTERF_STATUS) {
        return service.queryForList(c_APP_ID,c_INTERF_STATUS,c_INTERF_NAME,null);
    }

}
